package com.six.mapper;

import com.six.domain.dto.OrderQueryDTO;
import com.six.domain.entity.Order;
import com.six.domain.entity.OrderItem;
import com.six.domain.vo.MyOrderVO;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface OrderMapper {
    /* 原有 */
    int insertOrder(Order order);
    int insertItems(@Param("list") List<OrderItem> items);
    @Delete("DELETE FROM order_items WHERE order_id = #{orderId}")
    int deleteItemsByOrderId(@Param("orderId") Long orderId);

    /* 新增手写 SQL */
    Order selectById(@Param("id") Long id);
    int updateById(Order order);
    List<MyOrderVO> selectMyOrders(OrderQueryDTO dto);
    MyOrderVO selectDetail(@Param("id") Long id);
}